package cn.lut.springboot.web;

import cn.lut.springboot.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @user:dell
 * @date:2021年01月02 20:21
 */
@Controller
public class StudentController {
    @RequestMapping(value = "/student")
    @ResponseBody
    public Object student(Integer id,Integer age){
        Student student=new Student();
        student.setId(id);
        student.setAge(age);
        return student;
    }
    @RequestMapping(value = "/student/detail/{id}/{age}")
    @ResponseBody
    public Object student1(@PathVariable("id")Integer id,@PathVariable("age")Integer age){
       Map<String,Object> retMap=new HashMap<>();
       retMap.put("id",id);
       retMap.put("age",age);
        return retMap;
    }
}

